/**********************************************************************
**	Authors: Erik Sapir & Lior Zivi

**
**	This abstract class represent an Ordered Set that 
**	supports O(log N)  lookups, insertions and removals.
**	The Set also offers the methods: clean(), isEmpty() and size()
**
**
**********************************************************************/

#ifndef __CMDR_SET_H__
#define __CMDR_SET_H__

namespace CMDR {

template <typename T>
class set {
public:
	virtual ~set(){}

	/*******************************************************
	*	functio name: set::add
	*	Description: add a new element to the set
	*
	*	Input:	Item - new element to be added to the set 
	*			threadID - ID of the thread that called the function
	*
	*	Output - true iff item was added successfully 
	*
	*******************************************************/
	virtual bool add(const T& item, int threadID) =0;

	/*******************************************************
	*	functio name: set::remove
	*	Description: remove an element from the set
	*
	*	Input:	Item - element to be removed from the set 
	*			threadID - ID of the thread that called the function
	*
	*	Output - true iff item was removed successfully 
	*
	*******************************************************/
	virtual bool remove(const T& item, int threadID) =0;

	/*******************************************************
	*	functio name: set::contains
	*	Description: check if element is in the set
	*
	*	Input:	Item - 
	*			threadID - ID of the thread that called the function
	*
	*	Output - true iff item is in the set
	*
	*******************************************************/
	virtual bool contains(const T& item, int threadID) =0;

	/*******************************************************
	*	functio name: set::clean
	*	Description: clean the set
	*
	*	Input:	threadID - ID of the thread that called the function
	*
	*	Output - void
	*
	*******************************************************/
	virtual void clean(int threadID) =0;

	/*******************************************************
	*	functio name: set::isEmpty
	*	Description: check if set is empty
	*
	*	Input:	threadID - ID of the thread that called the function
	*
	*	Output - true iff set is empty
	*
	*******************************************************/
	virtual bool isEmpty(int threadID) =0;

	/*******************************************************
	*	functio name: set::size
	*	Description: get size of the set
	*
	*	Input:	threadID - ID of the thread that called the function
	*
	*	Output - size of the set
	*
	*******************************************************/
	virtual int size(int threadID) =0;
};

}//namespace CMDR

#endif


